package com.jd.header;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button mCommandBtn;
    private Button mInfoBtn;
    private Button mFormatBtn;
    private Button mCodecBtn;
    private TextView mAbiText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        getWindow().setStatusBarColor(Color.TRANSPARENT);
        setContentView(R.layout.activity_main);
        initView();
        initData();
    }

    private void initView() {
        mCommandBtn = findViewById(R.id.btn_command);
        mInfoBtn = findViewById(R.id.btn_info);
        mFormatBtn = findViewById(R.id.btn_format);
        mCodecBtn = findViewById(R.id.btn_codec);
        mAbiText = findViewById(R.id.tv_abi);

        mAbiText.setText(String.format("当前使用cpu-abi：%s", Build.CPU_ABI));
    }

    private void initData() {
        mCommandBtn.setOnClickListener(this);
        mInfoBtn.setOnClickListener(this);
        mFormatBtn.setOnClickListener(this);
        mCodecBtn.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_command:
                KFFmpegCommandActivity.Companion.start(this);
                break;
            case R.id.btn_info:
                KFFmpegInfoActivity.Companion.start(this);
                break;
            case R.id.btn_codec:
                KFFmpegCodecActivity.Companion.start(this);
                break;
            case R.id.btn_format:
                KFFmppegFormatActivity.Companion.start(this);
                break;
        }
    }
}